package com.hualian.coupon.util;

import lombok.Getter;

/**
 * @author Lxd
 * @Description TODO 统一响应体
 * @date 2020/10/22 5:50
 * @Version 1.0
 */
@Getter
public class ResultV0<T> {
    /**
     * 状态码,例:1001 成功
     */
    private final int code;

    /**
     * 响应信息,反应响应情况
     */
    private final String msg;

    /**
     * 响应数据
     */
    private final T data;

    public ResultV0(T data) {
        this(ResultCode.SUCCESS, data);
    }

    public ResultV0(ResultCode resultCode, T data) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
        this.data = data;
    }
}
